package com.example.saiaadmin.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.saiaadmin.dto.DTOEbSystemRole;
import com.example.saiaadmin.entry.EbSystemUser;
import com.example.saiaadmin.service.EbSystemRoleService;
import com.example.saiaadmin.utils.PageBean;
import com.example.saiaadmin.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 角色信息表Controller
 *
 *  @author  Vagrant
 * @since 2025/01/13
 */
@RestController
@RequestMapping("/eb-system-role")
public class EbSystemRoleController {

    @Autowired
    private EbSystemRoleService service;


    @GetMapping("/list")
    public ResultData<List> getList(){
        DTOEbSystemRole role = new DTOEbSystemRole();
        List<DTOEbSystemRole> list = service.getList(role.getId());
        return ResultData.success("查询成功",list);
    }

    /**
     * 获取角色数据列表树结构
     * @return
     */
    @GetMapping("/index")
    public ResultData<List> index(Integer page, Integer limit, String name, String code,  Integer status) {

        DTOEbSystemRole role = new DTOEbSystemRole();
        role.setName(name);
        role.setCode(code);
        role.setStatus(status);
        List<DTOEbSystemRole> list = service.gettreeList(role);
        return ResultData.success("success", list);
    }
}
